/*
 * @Author: DaQing Lu
 * @Date: 2020-02-12 17:00:49
 * @LastEditors  : DaQing Lu
 * @LastEditTime : 2020-02-15 13:21:28
 * @Description: file content
 */
import Types from '../actionTypes';

let initState = {
  pageCount: 1,
  unpaidOrderList: [],
  current: 1,
  unpaidOrderDetails: null
};

export default (state = initState, action) => {
  const newState = JSON.parse(JSON.stringify(state));
  switch (action.type) {
    case Types.GET_ORDER_LIBRARY:
      newState.unpaidOrderList = action.res.order;
      newState.pageCount = Number(action.res.pageCount);
      newState.current = Number(action.res.page);
      return newState;
    case Types.GET_UNPAR_SINGLE_DETAILS:
      newState.unpaidOrderDetails = action.data;
      return newState;
    default:
      console.log('Types no match in unpaidOrderLibrary.js ....');
  }
  return state;
}
